// @ts-ignore
import { api } from '@/utils/api';

/** 新增角色信息 POST /role/add */
export async function roleAdd(
  body: BASE.baocunjiaoseDTO,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultString>;

export async function roleAdd(
  body: BASE.baocunjiaoseDTO,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultString>>;

export async function roleAdd(
  body: BASE.baocunjiaoseDTO,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultString>;

export async function roleAdd(body: BASE.baocunjiaoseDTO, options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultString>(`/app/role/add`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultString>(`/app/role/add`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 给角色分配用户 POST /role/addByRole */
export async function roleAddByRole(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: BASE.roleAddByRoleParams,
  body: number[],
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultString>;

export async function roleAddByRole(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: BASE.roleAddByRoleParams,
  body: number[],
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultString>>;

export async function roleAddByRole(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: BASE.roleAddByRoleParams,
  body: number[],
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultString>;

export async function roleAddByRole(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: BASE.roleAddByRoleParams,
  body: number[],
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultString>(`/app/role/addByRole`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      params: {
        ...params
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultString>(`/app/role/addByRole`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    params: {
      ...params
    },
    data: body,
    ...(options || {})
  });
}

/** 给用户分配角色 POST /role/addByUser */
export async function roleAddByUser(
  body: BASE.AutoDtoWithRoleAddbyuser,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultString>;

export async function roleAddByUser(
  body: BASE.AutoDtoWithRoleAddbyuser,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultString>>;

export async function roleAddByUser(
  body: BASE.AutoDtoWithRoleAddbyuser,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultString>;

export async function roleAddByUser(
  body: BASE.AutoDtoWithRoleAddbyuser,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultString>(`/app/role/addByUser`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultString>(`/app/role/addByUser`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 取消角色与用户的绑定 POST /role/cancelBind */
export async function roleCancelBind(
  body: BASE.ManyToManyDTOLong,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultVoid>;

export async function roleCancelBind(
  body: BASE.ManyToManyDTOLong,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultVoid>>;

export async function roleCancelBind(
  body: BASE.ManyToManyDTOLong,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultVoid>;

export async function roleCancelBind(
  body: BASE.ManyToManyDTOLong,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultVoid>(`/app/role/cancelBind`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultVoid>(`/app/role/cancelBind`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 删除角色信息 POST /role/delete */
export async function roleDelete(
  body: BASE.ID,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultString>;

export async function roleDelete(
  body: BASE.ID,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultString>>;

export async function roleDelete(
  body: BASE.ID,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultString>;

export async function roleDelete(body: BASE.ID, options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultString>(`/app/role/delete`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultString>(`/app/role/delete`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 获取角色信息 POST /role/get */
export async function roleGet(
  body: BASE.ID,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultRole>;

export async function roleGet(
  body: BASE.ID,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultRole>>;

export async function roleGet(
  body: BASE.ID,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultRole>;

export async function roleGet(body: BASE.ID, options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultRole>(`/app/role/get`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultRole>(`/app/role/get`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 获取用户的角色信息 POST /role/getByUser */
export async function roleGetByUser(
  body: BASE.ID,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultListRole>;

export async function roleGetByUser(
  body: BASE.ID,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultListRole>>;

export async function roleGetByUser(
  body: BASE.ID,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultListRole>;

export async function roleGetByUser(body: BASE.ID, options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultListRole>(`/app/role/getByUser`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultListRole>(`/app/role/getByUser`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 获取角色列表 POST /role/list */
export async function roleList(
  body: BASE.RoleListQuery,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultListRole>;

export async function roleList(
  body: BASE.RoleListQuery,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultListRole>>;

export async function roleList(
  body: BASE.RoleListQuery,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultListRole>;

export async function roleList(body: BASE.RoleListQuery, options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultListRole>(`/app/role/list`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultListRole>(`/app/role/list`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 获取角色分页列表 POST /role/page */
export async function rolePage(
  body: BASE.RoleQuery,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultIPageRole>;

export async function rolePage(
  body: BASE.RoleQuery,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultIPageRole>>;

export async function rolePage(
  body: BASE.RoleQuery,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultIPageRole>;

export async function rolePage(body: BASE.RoleQuery, options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultIPageRole>(`/app/role/page`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultIPageRole>(`/app/role/page`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 更新角色信息 POST /role/update */
export async function roleUpdate(
  body: BASE.baocunjiaoseDTO,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultString>;

export async function roleUpdate(
  body: BASE.baocunjiaoseDTO,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultString>>;

export async function roleUpdate(
  body: BASE.baocunjiaoseDTO,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultString>;

export async function roleUpdate(
  body: BASE.baocunjiaoseDTO,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultString>(`/app/role/update`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultString>(`/app/role/update`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}
